package com._dev.social.common;

import lombok.Data;

import java.io.Serializable;

/**
 * 基础响应类
 *
 * @author wzp
 * @since 2024/8/10
 */
@Data
public class BaseResponse<T> implements Serializable {

    private static final long serialVersionUID = 2015396316965836956L;
    private Integer code;
    private String msg;
    private String describe;
    private T data;

    public BaseResponse() {
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), errorCode.getMsg(), errorCode.getDescribe(), null);
    }

    public BaseResponse(Integer code, String msg) {
        this(code, msg, "");
    }

    public BaseResponse(Integer code, String msg, String describe) {
        this(code, msg, describe, null);
    }

    public BaseResponse(Integer code, String msg, T data) {
        this(code, msg, "", data);
    }


    public BaseResponse(Integer code, String msg, String describe, T data) {
        this.code = code;
        this.msg = msg;
        this.describe = describe;
        this.data = data;
    }
}
